<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>w1002_2_locationObject</title>
		<script>
		
		window.onload=function(){
   
       document.getElementById("btn01").onclick=function(){
			 //현재 window의 current url... 뒤로가기o
			 location.href="http://www.naver.com";
		 };	
		  
		 document.getElementById("btn02").onclick=function(){
			 //Loads a new document... 뒤로가기o
			 location.assign("http://www.naver.com");
		 };	
		  
		 document.getElementById("btn03").onclick=function(){
	   //Replaces the current document with a new one
	   // 뒤로가기x
			 location.replace("http://www.naver.com");
		 };	
		  
		 document.getElementById("btn04").onclick=function(){
	   //Reloads the current document ..새로고침
			 location.reload();
		 };	
		 
		 //location객체.................
		  document.getElementById("btn05").onclick=function(){
	   //Returns the number of URLs in the history list
			 alert(history.length);
		 };		
  
		 document.getElementById("btn06").onclick=function(){
			 history.back();
		 };		
   	
		 document.getElementById("btn07").onclick=function(){
			 history.forward();
		 };		
  
  	 document.getElementById("btn08").onclick=function(){
			 history.go(-1);
		 };		
  
		};//end of window.onload
		</script>
	</head>
	<body>
		<h2>location객체</h2>
		<span id="btn01">location.href</span>
		<button id="btn02">location.assign()</button>
		<button id="btn03">location.replace()</button>
		<button id="btn04">location.reload()</button>

		<hr/>
		<h2>history객체</h2>
		<button id="btn05">history.length</button>
		<button id="btn06">history.back()</button>
		<button id="btn07">history.forward()</button>
		<button id="btn08">history.go()</button>
	</body>
</html>